//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>
package org.jpgolay.wi.realestate;

import java.awt.*;
import javax.swing.*;

public class RealEstatePanelGUI extends JPanel {

    public RealEstatePanelGUI() {
        jTabbedPane = null;
        mainPanel = null;
        detailsPanel = null;
        mainContentPanel = null;
        idTxtLabel = null;
        idLabel = null;
        refInternalTxtLabel = null;
        refInternalLabel = null;
        sortTxtLabel = null;
        sortLabel = null;
        typeTxtLabel = null;
        typeLabel = null;
        residanceTxtLabel = null;
        residanceLabel = null;
        areaTxtLabel = null;
        areaLabel = null;
        addrTxtLabel = null;
        addrLn1Label = null;
        addrLn2Label = null;
        cityTxtLabel = null;
        cityLabel = null;
        zipTxtLabel = null;
        zipLabel = null;
        rentTxtLabel = null;
        rentLabel = null;
        depositTxtLabel = null;
        depositLabel = null;
        detailsContentPanel = null;
        detailsScrollPane = null;
        detailsTextArea = null;
        initialize();
    }

    private void initialize() {
        setLayout(new BorderLayout());
        setSize(300, 182);
        add(getJTabbedPane(), "Center");
    }

    private JTabbedPane getJTabbedPane() {
        if (jTabbedPane == null) {
            jTabbedPane = new JTabbedPane();
            jTabbedPane.setPreferredSize(new Dimension(300, 180));
            jTabbedPane.addTab("Bien", new ImageIcon(getClass().getResource("/org/jpgolay/wi/images/logo.gif")), getMainPanel(), null);
            jTabbedPane.addTab("D\351tails", new ImageIcon(getClass().getResource("/org/jpgolay/wi/images/search18x18.png")), getDetailsPanel(), null);
        }
        return jTabbedPane;
    }

    private JPanel getMainPanel() {
        if (mainPanel == null) {
            FlowLayout flowLayout3 = new FlowLayout();
            mainPanel = new JPanel();
            mainPanel.setLayout(flowLayout3);
            mainPanel.setPreferredSize(new Dimension(290, 150));
            mainPanel.setBorder(BorderFactory.createLineBorder(Color.green, 2));
            mainPanel.setBackground(Color.white);
            mainPanel.setToolTipText("Extrait de la fiche bien");
            flowLayout3.setHgap(3);
            flowLayout3.setVgap(3);
            mainPanel.add(getMainContentPanel(), null);
        }
        return mainPanel;
    }

    private JPanel getDetailsPanel() {
        if (detailsPanel == null) {
            FlowLayout flowLayout4 = new FlowLayout();
            detailsPanel = new JPanel();
            detailsPanel.setLayout(flowLayout4);
            flowLayout4.setHgap(3);
            flowLayout4.setVgap(3);
            detailsPanel.setPreferredSize(new Dimension(290, 150));
            detailsPanel.setBorder(BorderFactory.createLineBorder(Color.blue, 2));
            detailsPanel.setBackground(Color.white);
            detailsPanel.setToolTipText("D\351tails de la fiche bien");
            detailsPanel.add(getDetailsContentPanel(), null);
        }
        return detailsPanel;
    }

    private JPanel getMainContentPanel() {
        if (mainContentPanel == null) {
            idTxtLabel = new JLabel();
            idLabel = new JLabel();
            refInternalTxtLabel = new JLabel();
            refInternalLabel = new JLabel();
            sortTxtLabel = new JLabel();
            sortLabel = new JLabel();
            typeTxtLabel = new JLabel();
            typeLabel = new JLabel();
            residanceTxtLabel = new JLabel();
            residanceLabel = new JLabel();
            areaTxtLabel = new JLabel();
            areaLabel = new JLabel();
            addrTxtLabel = new JLabel();
            addrLn1Label = new JLabel();
            addrLn2Label = new JLabel();
            cityTxtLabel = new JLabel();
            cityLabel = new JLabel();
            zipTxtLabel = new JLabel();
            zipLabel = new JLabel();
            rentTxtLabel = new JLabel();
            rentLabel = new JLabel();
            depositTxtLabel = new JLabel();
            depositLabel = new JLabel();
            mainContentPanel = new JPanel();
            mainContentPanel.setLayout(null);
            idTxtLabel.setText("Fiche N\260");
            idTxtLabel.setLocation(5, 2);
            idTxtLabel.setSize(50, 16);
            idLabel.setText("id");
            idLabel.setSize(82, 16);
            idLabel.setLocation(57, 2);
            refInternalTxtLabel.setText("R\351f. int.");
            refInternalTxtLabel.setSize(50, 16);
            refInternalTxtLabel.setLocation(141, 2);
            refInternalLabel.setText("refInternal");
            refInternalLabel.setSize(82, 16);
            refInternalLabel.setLocation(193, 2);
            sortTxtLabel.setText("Genre");
            sortTxtLabel.setSize(50, 16);
            sortTxtLabel.setLocation(5, 20);
            sortLabel.setText("sort");
            sortLabel.setSize(82, 16);
            sortLabel.setLocation(57, 20);
            typeTxtLabel.setText("Type");
            typeTxtLabel.setSize(50, 16);
            typeTxtLabel.setLocation(141, 20);
            typeLabel.setText("type");
            typeLabel.setSize(82, 16);
            typeLabel.setLocation(193, 20);
            residanceTxtLabel.setText("R\351sid.");
            residanceTxtLabel.setLocation(5, 38);
            residanceTxtLabel.setSize(50, 16);
            residanceTxtLabel.setToolTipText("R\351sidence");
            refInternalTxtLabel.setToolTipText("R\351f\351rence interne");
            idTxtLabel.setToolTipText("Num\351ro de fiche");
            residanceLabel.setText("residance");
            residanceLabel.setSize(82, 16);
            residanceLabel.setLocation(57, 38);
            areaTxtLabel.setText("Quartier");
            areaTxtLabel.setSize(50, 16);
            areaTxtLabel.setLocation(141, 38);
            areaLabel.setText("area");
            areaLabel.setSize(82, 16);
            areaLabel.setLocation(193, 38);
            addrTxtLabel.setText("Adres.");
            addrTxtLabel.setSize(50, 16);
            addrTxtLabel.setLocation(5, 56);
            addrTxtLabel.setToolTipText("Adresse");
            addrLn1Label.setText("addrLn1");
            addrLn1Label.setSize(108, 16);
            addrLn1Label.setLocation(57, 56);
            addrLn2Label.setText("addrLn2");
            addrLn2Label.setSize(108, 16);
            addrLn2Label.setLocation(167, 56);
            cityTxtLabel.setText("Ville");
            cityTxtLabel.setSize(50, 16);
            cityTxtLabel.setLocation(5, 74);
            cityLabel.setText("city");
            cityLabel.setSize(82, 16);
            cityLabel.setLocation(57, 74);
            zipTxtLabel.setText("CP");
            zipTxtLabel.setSize(50, 16);
            zipTxtLabel.setLocation(141, 74);
            zipTxtLabel.setToolTipText("Code postal");
            zipLabel.setText("zip");
            zipLabel.setSize(82, 16);
            zipLabel.setLocation(193, 74);
            rentTxtLabel.setText("Loyer");
            rentTxtLabel.setSize(50, 16);
            rentTxtLabel.setLocation(5, 128);
            rentLabel.setText("rent");
            rentLabel.setSize(82, 16);
            rentLabel.setLocation(57, 128);
            depositTxtLabel.setText("Caut.");
            depositTxtLabel.setSize(50, 16);
            depositTxtLabel.setLocation(141, 128);
            depositTxtLabel.setToolTipText("Caution");
            depositLabel.setText("deposit");
            depositLabel.setSize(82, 16);
            depositLabel.setLocation(193, 128);
            mainContentPanel.setPreferredSize(new Dimension(280, 146));
            mainContentPanel.setBackground(Color.white);
            mainContentPanel.add(idTxtLabel, null);
            mainContentPanel.add(idLabel, null);
            mainContentPanel.add(refInternalTxtLabel, null);
            mainContentPanel.add(refInternalLabel, null);
            mainContentPanel.add(sortTxtLabel, null);
            mainContentPanel.add(sortLabel, null);
            mainContentPanel.add(typeTxtLabel, null);
            mainContentPanel.add(typeLabel, null);
            mainContentPanel.add(residanceTxtLabel, null);
            mainContentPanel.add(residanceLabel, null);
            mainContentPanel.add(areaTxtLabel, null);
            mainContentPanel.add(areaLabel, null);
            mainContentPanel.add(addrTxtLabel, null);
            mainContentPanel.add(addrLn1Label, null);
            mainContentPanel.add(addrLn2Label, null);
            mainContentPanel.add(cityTxtLabel, null);
            mainContentPanel.add(cityLabel, null);
            mainContentPanel.add(zipTxtLabel, null);
            mainContentPanel.add(zipLabel, null);
            mainContentPanel.add(rentTxtLabel, null);
            mainContentPanel.add(rentLabel, null);
            mainContentPanel.add(depositTxtLabel, null);
            mainContentPanel.add(depositLabel, null);
        }
        return mainContentPanel;
    }

    private JPanel getDetailsContentPanel() {
        if (detailsContentPanel == null) {
            FlowLayout flowLayout5 = new FlowLayout();
            detailsContentPanel = new JPanel();
            detailsContentPanel.setLayout(flowLayout5);
            detailsContentPanel.setPreferredSize(new Dimension(280, 146));
            detailsContentPanel.setBackground(Color.white);
            flowLayout5.setHgap(2);
            flowLayout5.setVgap(2);
            detailsContentPanel.add(getDetailsScrollPane(), null);
        }
        return detailsContentPanel;
    }

    private JScrollPane getDetailsScrollPane() {
        if (detailsScrollPane == null) {
            detailsScrollPane = new JScrollPane();
            detailsScrollPane.setPreferredSize(new Dimension(270, 140));
            detailsScrollPane.setHorizontalScrollBarPolicy(31);
            detailsScrollPane.setViewportView(getDetailsTextArea());
        }
        return detailsScrollPane;
    }

    private JTextArea getDetailsTextArea() {
        if (detailsTextArea == null) {
            detailsTextArea = new JTextArea();
            detailsTextArea.setLineWrap(true);
            detailsTextArea.setWrapStyleWord(true);
            detailsTextArea.setRows(10);
            detailsTextArea.setEditable(false);
        }
        return detailsTextArea;
    }

    public String getAddrLn1Label() {
        return addrLn1Label.getText();
    }

    public void setAddrLn1Label(String txt) {
        addrLn1Label.setText(txt);
    }

    public String getAddrLn2Label() {
        return addrLn2Label.getText();
    }

    public void setAddrLn2Label(String txt) {
        addrLn2Label.setText(txt);
    }

    public String getCityLabel() {
        return cityLabel.getText();
    }

    public void setCityLabel(String txt) {
        cityLabel.setText(txt);
    }

    public String getDepositLabel() {
        return depositLabel.getText();
    }

    public void setDepositLabel(String txt) {
        depositLabel.setText(txt);
    }

    public String getIdLabel() {
        return idLabel.getText();
    }

    public void setIdLabel(String txt) {
        idLabel.setText(txt);
    }

    public String getRefInternalLabel() {
        return refInternalLabel.getText();
    }

    public void setRefInternalLabel(String txt) {
        refInternalLabel.setText(txt);
    }

    public String getRentLabel() {
        return rentLabel.getText();
    }

    public void setRentLabel(String txt) {
        rentLabel.setText(txt);
    }

    public String getResidanceLabel() {
        return residanceLabel.getText();
    }

    public void setResidanceLabel(String txt) {
        residanceLabel.setText(txt);
    }

    public String getSortLabel() {
        return sortLabel.getText();
    }

    public void setSortLabel(String txt) {
        sortLabel.setText(txt);
    }

    public String getTypeLabel() {
        return typeLabel.getText();
    }

    public void setTypeLabel(String txt) {
        typeLabel.setText(txt);
    }

    public String getZipLabel() {
        return zipLabel.getText();
    }

    public void setZipLabel(String txt) {
        zipLabel.setText(txt);
    }

    public void setDetailsTextArea(String txt) {
        getDetailsTextArea().setText(txt);
    }

    public String getAreaLabel() {
        return areaLabel.getText();
    }

    public void setAreaLabel(String txt) {
        areaLabel.setText(txt);
    }

    public void initFields() {
        setDetailsTextArea("");
        setZipLabel("");
        setTypeLabel("");
        setSortLabel("");
        setResidanceLabel("");
        setRentLabel("");
        setRefInternalLabel("");
        setIdLabel("");
        setDepositLabel("");
        setCityLabel("");
        setAddrLn2Label("");
        setAddrLn1Label("");
        setAreaLabel("");
    }
    private JTabbedPane jTabbedPane;
    private JPanel mainPanel;
    private JPanel detailsPanel;
    private JPanel mainContentPanel;
    private JLabel idTxtLabel;
    private JLabel idLabel;
    private JLabel refInternalTxtLabel;
    private JLabel refInternalLabel;
    private JLabel sortTxtLabel;
    private JLabel sortLabel;
    private JLabel typeTxtLabel;
    private JLabel typeLabel;
    private JLabel residanceTxtLabel;
    private JLabel residanceLabel;
    private JLabel areaTxtLabel;
    private JLabel areaLabel;
    private JLabel addrTxtLabel;
    private JLabel addrLn1Label;
    private JLabel addrLn2Label;
    private JLabel cityTxtLabel;
    private JLabel cityLabel;
    private JLabel zipTxtLabel;
    private JLabel zipLabel;
    private JLabel rentTxtLabel;
    private JLabel rentLabel;
    private JLabel depositTxtLabel;
    private JLabel depositLabel;
    private JPanel detailsContentPanel;
    private JScrollPane detailsScrollPane;
    private JTextArea detailsTextArea;
}
